package com.scnu.hachimi.element;

public class Arg {
    // 难度级别常量
    public static final int EASY = 0;
    public static final int MEDIUM = 1;
    public static final int HARD = 2;

    // 玩家参数配置
    public static class PlayerParams {
        public final int hp;
        public final int speed;
        public final int reload;
        public final int attack;
        public final int bulletSpeed;
        public final int bulletSize;

        public PlayerParams(int hp, int speed, int reload, int attack, int bulletSpeed, int bulletSize) {
            this.hp = hp;
            this.speed = speed;
            this.reload = reload;
            this.attack = attack;
            this.bulletSpeed = bulletSpeed;
            this.bulletSize = bulletSize;
        }
    }

    // 敌人参数配置
    public static class EnemyParams {
        public final int hp;
        public final int speed;
        public final int reload;
        public final int attack;
        public final int bulletSpeed;
        public final int bulletSize;

        public EnemyParams(int hp, int speed, int reload, int attack, int bulletSpeed, int bulletSize) {
            this.hp = hp;
            this.speed = speed;
            this.reload = reload;
            this.attack = attack;
            this.bulletSpeed = bulletSpeed;
            this.bulletSize = bulletSize;
        }
    }

    // 难度参数配置
    private static final PlayerParams[] PLAYER_PARAMS = {
            // 简单难度
            new PlayerParams(10, 3, 500, 1, 5, 10),
            // 中等难度
            new PlayerParams(20, 3, 500, 1, 5, 10),
            // 困难难度
            new PlayerParams(20, 3, 500, 1, 5, 10)
    };

    private static final EnemyParams[] BOT_PARAMS = {
            new EnemyParams(1, 2, 500, 1, 5, 10),
            new EnemyParams(1, 2, 500, 1, 5, 10),
            new EnemyParams(1, 2, 500, 1, 5, 10)
    };

    private static final EnemyParams[] ELITE_PARAMS = {
            new EnemyParams(2, 2, 500, 2, 5, 10),
            new EnemyParams(3, 3, 500, 2, 5, 10),
            new EnemyParams(4, 3, 500, 2, 5, 10)
    };

    private static final EnemyParams[] BOSS_PARAMS = {
            new EnemyParams(10, 2, 500, 3, 5, 10),
            new EnemyParams(10, 2, 500, 3, 5, 10),
            new EnemyParams(15, 2, 200, 5, 5, 10)
    };

    // 每波敌人数量配置 [简单, 中等, 困难]
    private static final int[][] BATCH_COUNTS = {
            {5, 5, 10},   // 第1波
            {10, 15, 15}, // 第2波
            {15, 20, 20}  // 第3波
    };

    // 获取玩家参数
    public static PlayerParams getPlayerParams(int difficulty) {
        if (difficulty < 0 || difficulty >= PLAYER_PARAMS.length) {
            throw new IllegalArgumentException("Invalid difficulty level: " + difficulty);
        }
        return PLAYER_PARAMS[difficulty];
    }

    // 获取普通敌人参数
    public static EnemyParams getBotParams(int difficulty) {
        if (difficulty < 0 || difficulty >= BOT_PARAMS.length) {
            throw new IllegalArgumentException("Invalid difficulty level: " + difficulty);
        }
        return BOT_PARAMS[difficulty];
    }

    // 获取精英敌人参数
    public static EnemyParams getEliteParams(int difficulty) {
        if (difficulty < 0 || difficulty >= ELITE_PARAMS.length) {
            throw new IllegalArgumentException("Invalid difficulty level: " + difficulty);
        }
        return ELITE_PARAMS[difficulty];
    }

    // 获取Boss参数
    public static EnemyParams getBossParams(int difficulty) {
        if (difficulty < 0 || difficulty >= BOSS_PARAMS.length) {
            throw new IllegalArgumentException("Invalid difficulty level: " + difficulty);
        }
        return BOSS_PARAMS[difficulty];
    }

    // 获取每波敌人数量
    public static int getBatchCount(int batch, int difficulty) {
        if (batch < 1 || batch > 3) {
            throw new IllegalArgumentException("Invalid batch number: " + batch);
        }
        if (difficulty < 0 || difficulty > 2) {
            throw new IllegalArgumentException("Invalid difficulty level: " + difficulty);
        }
        return BATCH_COUNTS[batch - 1][difficulty];
    }
}